package org.jeecg.modules.bigdatashow.service.impl;

import org.jeecg.modules.bigdatashow.entity.Common;
import org.jeecg.modules.bigdatashow.entity.Traffic;
import org.jeecg.modules.bigdatashow.mapper.TrafficMapper;
import org.jeecg.modules.bigdatashow.service.TrafficService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TrafficServiceImpl implements TrafficService {
    @Autowired
    private TrafficMapper trafficMapper;

    @Override
    public List<Common> findTrafficNumber() {
        return trafficMapper.findTrafficNumber();
    }

    @Override
    public Traffic findTrafficVisitor() {
        Traffic traffic = new Traffic();
        //从游客表中查询出乘坐各种交通工具的数量
        Integer car = trafficMapper.getCar();
        Integer train = trafficMapper.getTrain();
        Integer plane = trafficMapper.getPlane();
        Integer driving = trafficMapper.getDriving();
        Integer publics = trafficMapper.getPublic();
        Integer other = trafficMapper.getOther();

        traffic.setCar(car);
        traffic.setTrain(train);
        traffic.setPlane(plane);
        traffic.setDriving(driving);
        traffic.setPublics(publics);
        traffic.setOther(other);

        return traffic;
    }
}
